Social media in comparative politics

Class 6

Sebastian Stier

Teaching Presentation @ University of Hamburg, Summer Semester 2025

2025-05-13

Seminar dates and topics

Date Topics Required reading

8 April 2025

  • Introduction and expectations
  • Setup in R

15 April 2025

  • Foundations of data science
  • Foundations of comparative politics
  • The tidyverse in R

Caramani, D. (Ed.). (2017). Comparative politics (4th edition). Oxford University Press.

Lazer, D., & Radford, J. (2017). Data ex Machina: Introduction to Big Data. Annual Review of Sociology, 43(1), 19–39.

22 April 2025

  • Democracy and autocracy
  • Data sources in comparative politics
  • Data wrangling in R: joining, grouping and reshaping data

Coppedge, M., Gerring, J., Knutsen, C. H., Lindberg, S. I., Teorell, J., Altman, D., Angiolillo, F., Bernhard, M., Borella, C., & Cornell, A. (2024). V-Dem Codebook v14.

Moses, J., & Knutsen, T. L. (2012). The comparative method. In J. Moses & T. L. Knutsen (Eds.), Ways of knowing: Competing methodologies in social and political research (2. ed, pp. 94–115). Palgrave Macmillan.

29 April 2025

  • Party competition and ideology in Europe
  • Party manifestos and legislative speech
  • Data visualization in R

Kriesi, H., & Hutter, S. (2019). Crises and the transformation of the national political space in Europe. In H. Kriesi & S. Hutter (Eds.), European party politics in times of crisis (pp. 3–32). Cambridge University Press.

Sebők, M., Proksch, S.-O., Rauh, C., Visnovitz, P., Balázs, G., & Schwalbach, J. (2023). Comparative European legislative research in the age of large-scale computational text analysis: A review article. International Political Science Review.

6 May 2025

  • The Internet and democracy
  • Regression analysis and presentation of results in R

Keremoğlu, E., & Weidmann, N. B. (2020). How dictators control the internet: A review essay. Comparative Political Studies, 53(10–11), 1690–1703.

Tucker, J. A., Theocharis, Y., Roberts, M. E., & Barberá, P. (2017). From liberation to turmoil: Social media and democracy. Journal of Democracy, 28(4), 46–59.

13 May 2025

  • Social media in comparative politics
  • Text as data in R

Barberá, P., Gohdes, A. R., Iakhnis, E., & Zeitzoff, T. (2024). Distract and Divert: How World Leaders Use Social Media During Contentious Politics. The International Journal of Press/Politics, 29(1), 47–73.

Grimmer, J., & Stewart, B. M. (2013). Text as Data: The Promise and Pitfalls of Automatic Content Analysis Methods for Political Texts. Political Analysis, 21(3), 267–297.

Agenda for today

  1. Recap

  2. Social media in political science

  3. Introduction to text as data in R

  4. Text as data in political science

Learning objectives for today

After this class you will be able to…

  1. describe the role of social media and politics,
  2. critically reflect upon the value of social media data in comparative politics,
  3. work with text as data using quanteda in R.

1. Recap

Country-year macro data

head(gapminder)

Data visualization

# Plot
ggplot(gapminder, aes(x = gdpPercap, 
                      y = lifeExp)) + 
  geom_point(alpha = 0.6) +
  geom_smooth(method = "loess") + 
  scale_x_log10() + 
  labs(title = "GDP/Capita and Life Expectancy", 
       x = "GDP/Capita (logged)", 
       y = "Life Expectancy (in years)")

2. Social media in political science

Social networking sites

“We define social network sites as web-based services that allow individuals to

  1. construct a public or semi-public profile within a bounded system,
  2. articulate a list of other users with whom they share a connection, and
  3. view and traverse their list of connections and those made by others within the system.

The nature and nomenclature of these connections may vary from site to site.” (boyd and Ellison 2007: 211)

Twitter/X

https://x.com/WWF_Deutschland/status/1684871776822542338

Societal relevance of Twitter

What is the share of weekly Twitter users among the German population?

Societal relevance of Twitter

What is the share of German federal election candidates with a Twitter account?

Sältzer, M., & Stier, S. (2022). Die Bundestagswahl 2021 auf Twitter. easy social sciences, 67, 30-38.

Why social media still matter

  • Hybrid media system (Chadwick 2013): Journalists and (political) elites are disproportionately active on Twitter
  • Agenda setting: Emerging societal topics like #metoo or #blacklivesmatter
  • Important platform for (transnational) mobilization, e.g., Fridays for Future (Schürmann 2024)

Think-pair-share: Social media data in political science

  1. Discuss the literature for today with your neighbor (5 min.)
  2. Focus on the used methods, their pros and cons, feasibility, etc.
  3. What are the advantages of social media data for comparative politics?
  4. Share and discuss your results with the full class

Barberá, P., Gohdes, A. R., Iakhnis, E., & Zeitzoff, T. (2024). Distract and Divert: How World Leaders Use Social Media During Contentious Politics. The International Journal of Press/Politics, 29(1), 47–73.

Format of the reviews

Guiding questions

- Describe what problem or question these papers address and the main contributions that they make towards a solution or answer. 

- Reflect on the main strengths and weaknesses of these papers.

- What are the concepts, assumed social mechanisms and operationalizations used in the papers?

- What are the data in use? How are the data analyzed? Does this seem appropriate?

- How convincing do you find the arguments presented by the authors? Are the conclusions backed up by the empirical results?

- Do you see any ethical concerns?

- If papers are empirical, how do you judge their replicability?

- If applicable, are there commonalities or differences between the two papers? How do they relate to each other?

3. Introduction to text as data in R

Automated text analysis in R

Benoit, K., Watanabe, K., Wang, H., Nulty, P., Obeng, A., Müller, S., Matsuo, A., Perry, P. O., Kuha, J., & Lauderdale, B. (2018). quanteda: An R package for the quantitative analysis of textual data. Journal of Open Source Software, 3(30), 774.

Trump Twitter Archive

https://www.thetrumparchive.com

Coding

4. Text as data in political science

Automated text analysis: The menu of options

Grimmer, J., & Stewart, B. M. (2013). Text as Data: The Promise and Pitfalls of Automatic Content Analysis Methods for Political Texts. Political Analysis, 21(3), 267–297.

Important terms

  • Document: the main unit of analysis containing the text
    • There might be document-level variables like an author, time, source, etc.
  • Corpus: a collection of several documents
  • Token: converting a sequence of text into smaller parts, e.g., words
  • Document-Feature Matrix (DFM): a matrix of documents and features (tokens)
  • Stopwords: commonly used words in a language (e.g., the, a, are) that do not carry much useful information when you want to classify text

From text to numbers: word-to-word matrix

From text to numbers: a document-feature matrix

Bag-of-words representation of text

Distributional semantics

  • A word’s meaning is given by the words that frequently appear close by

    \(\rightarrow\) One of the most successful ideas in Natural Language Processing

  • Context

    \(\rightarrow\) When a word appears in a text, its context is a set of words that appear nearby (within a fixed window): car, street, traffic

Thank you for your attention! See you on May 20 2025

References

boyd, danah m., and Nicole B. Ellison. 2007. “Social Network Sites: Definition, History, and Scholarship.” Journal of Computer-Mediated Communication 13 (1): 210–30. https://doi.org/10.1111/j.1083-6101.2007.00393.x.
Chadwick, Andrew. 2013. The Hybrid Media System: Politics and Power. Oxford: Oxford University Press.
Oschatz, Corinna, Sebastian Stier, and Jürgen Maier. 2021. “Twitter in the News: An Analysis of Embedded Tweets in Political News Coverage.” Digital Journalism. https://doi.org/10.1080/21670811.2021.1912624.
Schürmann, Lennart. 2024. “The Impact of Local Protests on Political Elite Communication: Evidence from Fridays for Future in Germany.” Journal of Elections, Public Opinion and Parties 34 (3): 510–30. https://doi.org/10.1080/17457289.2023.2189729.